<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>任务</title>
    <%@include file="/common/commonCSS.jsp" %>
    <%@include file="/common/commonJS.jsp" %>
    <%@include file="/WEB-INF/jsp/include/taglib.jsp" %>
</head>

<body>
<div class="main-container" id="main-container">

    <div class="row" style="margin-top: 20px;">
        <div class="col-md-12">
           <form class="layui-form" id="search-from" action="${webRoot}/assign/list">
                <div class="layui-form-item">
                    <%--<label class="layui-form-label" style="width:6%;">标题:</label>--%>
                    <div class="layui-input-inline">
                        <input type="text" name="assignTopic" value="${assign.assignTopic}"  placeholder="请输入标题"  class="layui-input" >
                    </div>
                    <button class="layui-btn" id="searchSubmit"><i class="layui-icon">&#xe615;</i>搜 索</button>
                    <button class="layui-btn layui-btn-normal" type="button" id="refresh"><i class="layui-icon">&#x1005;</i>重 置</button>
                    <a class="layui-btn" href="${webRoot}/assign/info"><i class="layui-icon">&#xe61f;</i> 新 增</a>
                </div>
            </form>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <table id="table-list" class="layui-table" lay-size="sm">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>工单编号</th>
                    <th>标题</th>
                    <th>创建时间</th>
                    <th>业务系统</th>
                    <th>请求人</th>
                    <th>工单状态</th>
                    <th>优先级</th>
                    <c:forEach items="${fieldList}" var="firld" varStatus="i">
                        <th>${firld.fieldName}</th>
                    </c:forEach>
                    <th>操作</th>

                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.result}" var="assign" varStatus="i">
                    <tr id="${assign.id }">
                        <td>${i.index+1 }</td>
                        <td>${assign.assignCode}</td>
                        <td>${assign.assignTopic}</td>
                        <td><fmt:formatDate value="${assign.assignCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                        <td>${assign.operationName}</td>
                        <td>${assign.reqName}</td>
                        <td>${fns:getCodeName("assign_status",assign.status)}</td>
                        <td>${fns:getCodeName("pro_priority",assign.priority)}</td>
                        <c:forEach items="${assign.valueDictionarys}" var="valueDictionary">
                            <td>${valueDictionary.fieldValue}</td>
                        </c:forEach>
                        <td>
                            <div class=" btn-group ">
                                <c:if test="${assign.status == 0}">
                                    <a class="layui-btn layui-btn-small" title="编辑" href="${webRoot}/assign/info?id=${assign.id}" ><i class="layui-icon">&#xe642;</i></a>
                                    <button class="layui-btn layui-btn-small" title="提交" type="button" onclick="flowSumbit('assign','${assign.id}')"><i class="layui-icon">&#xe62f;</i></button>
                                    <button class="layui-btn layui-btn-danger layui-btn-small" title="删除" type="button" onclick="deleteById('${assign.id}')"><i class="layui-icon">&#xe640;</i></button>
                                </c:if>
                                <c:if test="${(assign.status == 1 || assign.status == 2 || assign.status == 3 || assign.status == 4)}">
                                    <button class="layui-btn layui-btn-small" type="button" title="审批记录" onclick="doTaskTab('assign','${assign.id}','${assign.instanceId}')"><i class="layui-icon">&#xe60e;</i></button>
                                    <button class="layui-btn layui-btn-small layui-btn-warm" type="button" title="查看流程图" onclick="showFlowImg('${assign.instanceId}')"><i class="layui-icon">&#xe64a;</i></button>
                                </c:if>
                                <c:if test="${assign.status == 5}">
                                    <button class="layui-btn layui-btn-small" type="button" title="审批记录" onclick="doTaskTab('assign','${assign.id}','${assign.instanceId}')"><i class="layui-icon">&#xe60e;</i></button>
                                    <button class="layui-btn layui-btn-small layui-btn-warm" type="button" title="查看流程图" onclick="showFlowImg('${assign.instanceId}')"><i class="layui-icon">&#xe64a;</i></button>
                                </c:if>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <sys:page page="${page}"></sys:page>
        </div>
    </div>
</div>
</body>
<script src="${webRoot}/js/activiti/actSumbit.js"></script>
<script>
    function deleteById(id) {
        var url ="${webRoot}/assign/delete";
        confirm('确定要删除选中的记录？', function(){
            $.post(url,"id="+id,function (r) {
                if(r.code=='0'){
                    toast(r.msg);
                    location.href='${webRoot}/assign/list';
                }else {
                    alertMsg(r.msg);
                }
            });
        });
    }
</script>

</html>